<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
<!--
Copyright 2008, 2009, 2010 Miguel Ángel Laguna Lobato

This file is part of Multiclinical Trial Web-PACS.

Multiclinical  Trial Web-PACS is free  software: you  can redistribute 
as published by the Free  Software Foundation, either version 3 of the 
License, or (at your option) any later version.

Multiclinical  Trial Web-PACS is distributed  in the hope that it will 
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
of  MERCHANTABILITY or  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
General Public License for more details.

You should have received a copy of the GNU General Public License
along with Multiclinical Trial Web-PACS.  If not, see 
<http://www.gnu.org/licenses/>. 
 -->

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:p="http://primefaces.prime.com.tr/ui">
      
<ui:composition template="/jsp/include/templateRsc.xhtml">
<ui:define name="cuerpo">

<t:saveState value="#{modalityIBean.user}" />
<t:saveState value="#{modalityIBean.users}" />
<t:saveState value="#{modalityIBean.modalities}" />

<!-- Comienza la página JSF -->

<div class="cuerpo">

	<ui:insert name="saveState" />
	
	<h:form id="mainForm" prependId="false">
	
	<table class="cuerpoCentrado">
		<tr>
			<td class="textoCentrado">
				<h3>
					<h:outputText value="#{msgs['jsf.headers.ModalitiesMngt']}"/>
				</h3>
			</td>
		</tr>
		<tr>
			<td>
				<hr/>
			</td>
		</tr>
		<tr>
			<td>
				<h:panelGrid id="selectUser" columns="2" styleClass="frmTabla">
							
					<h:outputLabel value="#{msgs['jsf.generic.User']}" styleClass="frmLabel" for="user" />
					<h:selectOneMenu id="user" styleClass="frmSelectOne" value="#{modalityIBean.userSelected}">
						<p:ajax event="change" update="results, buttons, action" action="#{modalityIBean.accPrepareModalities}" />
						<f:selectItem itemValue="#{null}" itemLabel="..." />
						<f:selectItems value="#{modalityIBean.users}"/>
					</h:selectOneMenu>
					
				</h:panelGrid>
			</td>
		</tr>
		<tr>
			<td class="entreLineas">
				<p:dataTable id="results"
					var="row" rows="10"
					paginator="true" paginatorPosition="bottom"  
					value="#{modalityIBean.userModalitiesAsList}">
						
					<p:column sortBy="#{row.name}" parser="string">
						<f:facet name="header">
							<h:outputText value="#{msgs['jsf.generic.Name']}" />
						</f:facet>
						<h:outputText value="#{row.name}"/>
					</p:column>
			
					<p:column>
						<f:facet name="header">
							<h:outputText value="#{msgs['jsf.generic.Modalities']}" />
						</f:facet>
						
						<h:commandLink action="#{modalityIBean.accDelUserModality}" >
							<h:graphicImage value="/jsp/icons/cross.png" alt="#{msgs['jsf.actions.Delete']}" />
							<t:updateActionListener value="#{row.code}" property="#{modalityIBean.modalitySelected}" />
						</h:commandLink>
					</p:column>										
		
				</p:dataTable>	
			</td>
		</tr>
		<tr>
			<td>
				<table class="frmBotonera">
					<tr>
						<td>
							<h:panelGrid id="buttons" columns="5" styleClass="frmTabla">
								
								<f:facet name="header">
									<h:panelGroup styleClass="headFrm">
										<h:outputText value="#{msgs['jsf.headers.AddModality']}" />
									</h:panelGroup>
								</f:facet>			
							
								<h:outputLabel value="Actions" styleClass="frmLabel"/>
								<h:selectOneMenu id="action"  value="#{modalityIBean.modalitySelected}" styleClass="frmSelectOne">
									<f:selectItem itemValue="#{null}" itemLabel="..." />
									<f:selectItems value="#{modalityIBean.modalities}" />
								</h:selectOneMenu>
								<t:message id="actionError" for="action" />	
								
								<h:commandButton id="anadir" value="#{msgs['jsf.actions.Add']}" action="#{modalityIBean.accAddUserModality}" styleClass="frmButton" />

							</h:panelGrid>	
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
		
	</h:form>
	
</div>

<!-- Termina la página JSF -->

</ui:define>
</ui:composition>

</html>